const { defineConfig } = require('@vue/cli-service')

const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')

module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false,//关闭语法检查
  configureWebpack: {
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver({ importStyle: false })],
      }),
      Components({
        resolvers: [ElementPlusResolver({ importStyle: false })],
      }),
    ],
  },
  devServer: {
    proxy: {
      '/api': {
        target: 'http://localhost:8000',
        ws: true,//用于支持websocket
        changeOrigin: true,
        pathRewrite: {'^/api': ''}//重写请求，用正则表达式匹配
      },
    }
  }
})
